import request from '@/utils/request'
import type { LoginPayload, LoginResult, UserInfoResult, ChangePasswordPayload, ChangePasswordResult } from '@/types/auth'

export const loginApi = (payload: LoginPayload) =>
  request.post<LoginResult>('/api/v1/auth/login', payload)

export const logoutApi = () => request.post('/api/v1/auth/logout')

export const getUserInfoApi = () =>
  request.get<UserInfoResult>('/api/v1/auth/userinfo')

export const changePasswordApi = (payload: ChangePasswordPayload) =>
  request.post<ChangePasswordResult>('/api/v1/auth/change-password', payload)
